package com.pattern.demo;

import com.pattern.demo.abstracts.Duck;
import com.pattern.demo.behavior.fly.FlyRocketPowered;

/**
 * @ClassName: TestMain
 * @Description:
 * @Date: 2020/8/26 14:27
 * @Author: Song JinGen
 */
public class TestMain {
    public static void main(String[] args) {
        System.out.println("-------------野鸭子-------------------");
        Duck mallardDuck = new MallardDuck();
        mallardDuck.display();
        mallardDuck.swim();
        mallardDuck.performFly();
        mallardDuck.performQuack();

        System.out.println("---------------模型鸭-----------------");
        Duck modeDuck = new ModeDuck();
        modeDuck.display();
        modeDuck.swim();
        modeDuck.performFly();
        modeDuck.setFlyBehavior(new FlyRocketPowered());
        modeDuck.performFly();
        modeDuck.performQuack();
    }
}
